<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2620. 计数器</title>
</head>

<body>

</body>

<script>
    /**
     * @param {number} n
     * @return {Function} counter
     */
    var createCounter = function (n) {
        let count;
        return function () {
            count = n++;
            return count;
        };
    };

    /**
     * const counter = createCounter(10)
     * counter() // 10
     * counter() // 11
     * counter() // 12
     */
</script>

</html>